<?php
// +----------------------------------------------------------------------
// | 幕小铺
// +----------------------------------------------------------------------
// | 版权所有 2016~2020 幕小铺科技（大连）有限公司
// +----------------------------------------------------------------------
// | 2020/03/14
// +----------------------------------------------------------------------
namespace app\user_center\behavior\user\register_wechat_after;

/**
 * 更新登录信息
 * @package app\user_center\behavior\user\register_wechat_after
 * @author shiqiang
 */
class updateLoginInfo{
    public function run($params){
		$openid  	 = $params['openid'];
		$unionid 	 = $params['unionid'];
		
		$map = [];
		$map['open_id'] = $openid;
		if($unionid != ''){
			$map['unionid'] = $unionid;
		}
		
		$result = model('UcMemberWechat', 'model\user') -> whereOr($map) -> find();//获取uid
		$uid = $result->uid;
		
		$last_login_type = 2;//微信登陆
		$result = model('Member', 'model\user') -> updateUserLogin($uid, $last_login_type);
	}
}